#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# @Project : chat_model 
# @File    : embedding_server_model.py
# @IDE     : PyCharm 
# @Author  :ZH
# @Time    : 2025/1/10 11:29
from tortoise import fields

from apps.models.base_model import BaseModel
from apps.utils.enumerate import EmbeddingServerEnum


class EmbeddingServer(BaseModel):
    __doc__ = "向量服务配置表"
    embedding_name = fields.CharField(max_length=256, null=False, description='向量服务名称')
    server_base_url = fields.CharField(max_length=256, null=False, description='向量服务地址')
    server_type = fields.IntEnumField(EmbeddingServerEnum, default=EmbeddingServerEnum.bce, description='向量服务类型')
    dimension = fields.IntField(default=1024, null=False, description='向量维度')
    vector_store_id = fields.IntField(null=True, description='向量存储库id')
    table_name = fields.CharField(max_length=256, null=True, description='表名')
    other_config = fields.JSONField(default=None, null=True, description='其他配置')
    api_key = fields.CharField(max_length=256, null=True, description='api_key')
    model_name = fields.CharField(max_length=256, null=True, description='模型名称')
    description = fields.CharField(max_length=256, null=True, description='描述')
    is_default = fields.BooleanField(default=False, description='是否默认')

    class Meta:
        table = "embedding_server"
        table_description = "向量服务配置表"
